package com.dkd.sbtz.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.dkd.sbtz.mapper.AssetOrderAttachmentMapper;
import com.dkd.sbtz.domain.AssetOrderAttachment;
import com.dkd.sbtz.service.IAssetOrderAttachmentService;

/**
 * 工单附件Service业务层处理
 * 
 * @author xzj
 * @date 2025-09-18
 */
@Service
public class AssetOrderAttachmentServiceImpl implements IAssetOrderAttachmentService 
{
    @Autowired
    private AssetOrderAttachmentMapper assetOrderAttachmentMapper;

    /**
     * 查询工单附件
     * 
     * @param id 工单附件主键
     * @return 工单附件
     */
    @Override
    public AssetOrderAttachment selectAssetOrderAttachmentById(Long id)
    {
        return assetOrderAttachmentMapper.selectAssetOrderAttachmentById(id);
    }

    /**
     * 查询工单附件列表
     * 
     * @param assetOrderAttachment 工单附件
     * @return 工单附件
     */
    @Override
    public List<AssetOrderAttachment> selectAssetOrderAttachmentList(AssetOrderAttachment assetOrderAttachment)
    {
        return assetOrderAttachmentMapper.selectAssetOrderAttachmentList(assetOrderAttachment);
    }

    /**
     * 新增工单附件
     * 
     * @param assetOrderAttachment 工单附件
     * @return 结果
     */
    @Override
    public int insertAssetOrderAttachment(AssetOrderAttachment assetOrderAttachment)
    {
        return assetOrderAttachmentMapper.insertAssetOrderAttachment(assetOrderAttachment);
    }

    /**
     * 修改工单附件
     * 
     * @param assetOrderAttachment 工单附件
     * @return 结果
     */
    @Override
    public int updateAssetOrderAttachment(AssetOrderAttachment assetOrderAttachment)
    {
        return assetOrderAttachmentMapper.updateAssetOrderAttachment(assetOrderAttachment);
    }

    /**
     * 批量删除工单附件
     * 
     * @param ids 需要删除的工单附件主键
     * @return 结果
     */
    @Override
    public int deleteAssetOrderAttachmentByIds(Long[] ids)
    {
        return assetOrderAttachmentMapper.deleteAssetOrderAttachmentByIds(ids);
    }

    /**
     * 删除工单附件信息
     * 
     * @param id 工单附件主键
     * @return 结果
     */
    @Override
    public int deleteAssetOrderAttachmentById(Long id)
    {
        return assetOrderAttachmentMapper.deleteAssetOrderAttachmentById(id);
    }





    @Override
    public List<AssetOrderAttachment> listByOrderId(Long orderId) {
        return assetOrderAttachmentMapper.selectByOrderId(orderId);
    }

    @Override
    public int saveBatch(List<AssetOrderAttachment> list) {
        int cnt = 0;
        for (AssetOrderAttachment a : list) {
            cnt += assetOrderAttachmentMapper.insert(a);
        }
        return cnt;
    }

    @Override
    public int deleteByIds(Long[] ids) {
        return assetOrderAttachmentMapper.deleteByIds(ids);
    }
}
